GNU Emacs 23.1.1, the first release to feature antialiased fonts on X. |
|
Original author(s) | Richard Stallman |
Developer(s) | the GNU project |
Initial release | 1976, 34–35 years ago |
Written in | C and Emacs Lisp |
Operating system | Cross-platform, GNU |
Available in | English |
Type | Text editor |
License | GNU GPLv3+ |
Website | http://www.gnu.org/software/emacs/ |
Based on GNU Emacs | |
---|---|
XEmacs · SXEmacs · Aquamacs | |
Emacs Lisp | |
Independent codebases | |
Freemacs · Gosling Emacs · Hemlock · JOVE · mg · MicroEMACS · Zile | |
Emacs (pronounced /ˈiːmæks/) is a class of feature-rich text editors, usually characterized by their extensibility. Emacs has, perhaps, more editing commands than other editors, numbering over 1,000 commands. It also allows the user to combine these commands into macros to automate work.
Development began in the mid-1970s and continues actively as of 2010[update]. Emacs text editors are most popular with technically proficient computer users and computer programmers. The most popular version of Emacs is GNU Emacs, a part of the GNU project, which is commonly referred to simply as "Emacs".
The GNU Emacs manual describes it as "the extensible, customizable, self-documenting, real-time display editor." It is also the most ported of the implementations of Emacs. As of May 2010[update], the latest stable release of GNU Emacs is version 23.2.
Aside from GNU Emacs, another version of Emacs in common use, XEmacs, forked from GNU Emacs in 1991. XEmacs has remained mostly compatible and continues to use the same extension language, Emacs Lisp, as GNU Emacs. Large parts of GNU Emacs and XEmacs are written in Emacs Lisp, so the extensibility of Emacs' features is deep.
The original EMACS consisted of a set of Editor MACroS for the TECO editor. It was written in 1976 by Richard Stallman, initially together with Guy L. Steele, Jr.[1] It was inspired by the ideas of TECMAC and TMACS, a pair of TECO-macro editors written by Steele, Dave Moon, Richard Greenblatt, Charles Frankston, and others.[2]
In Unix culture, Emacs became one of the two main contenders in the traditional editor wars, the other being vi. The word "emacs" is often pluralized as emacsen, by analogy with boxen (itself used by analogy with oxen) and VAXen.[3]
Contents |
Emacs development began at the MIT AI Lab during the 1970s. Before its introduction, the Incompatible Timesharing System (ITS), the operating system on the AI Lab's PDP-6 and PDP-10 computers, featured a default line editor known as Tape Editor and Corrector (TECO) (later changed to Text Editor and Corrector, the 'tape' referring to paper tape). Unlike most modern text editors, TECO has separate modes which the user used to either add text, edit existing text, or display the document. Typing characters into TECO did not place those characters directly into a document; one had to write a series of instructions in the TECO command language telling it to enter the required characters, during which time the edited text was not displayed on the screen. This behavior is similar to the program ed.
Richard Stallman visited the Stanford AI Lab in 1972 or 1974 and saw the lab's "E" editor, written by Fred Wright. The editor had an intuitive WYSIWYG (What You See Is What You Get) behavior as used almost universally by modern text editors, which impressed Stallman. He returned to MIT where Carl Mikkelsen, a hacker at the AI Lab, had added a combined display+editing mode called "Control-R" to TECO, allowing the screen display to be updated each time the user entered a keystroke. Stallman reimplemented this mode to run efficiently, then added a macro feature to the TECO display-editing mode, allowing the user to redefine any keystroke to run a TECO program.
E had another feature which TECO lacked: random-access editing. Since TECO's original implementation was designed for editing paper tape on the PDP-1, it was a page-sequential editor. Typical editing could only be done on one page at a time, in the order of the pages in the file. To provide random access in Emacs, Stallman decided not to adopt E's approach of structuring the file for page-random access on disk, but instead modified TECO to handle large buffers more efficiently, and then changed its file management method to read, edit, and write the entire file as a single buffer. Almost all modern editors use this approach.
The new version of TECO quickly became popular at the AI Lab, and soon there accumulated a large collection of custom macros, whose names often ended in "MAC" or "MACS", which stood for "macro". Two years later, Guy Steele took on the project of unifying the overly diverse macros into a single set. After one night of joint hacking by Steele and Stallman, the latter finished the implementation, which included facilities for extending and documenting the new macro set. The resulting system was called EMACS, which stood for "Editing MACroS". An alternative version is that EMACS stood for "E with MACroS", a dig at E's lack of a macro capability. According to Stallman, he picked the name Emacs "because <E> was not in use as an abbreviation on ITS at the time."[4] (It has also been noted that "Emack & Bolio's" was the name of a popular ice cream store in Cambridge, within walking distance of MIT. A text-formatting program used on ITS was later named BOLIO by Dave Moon, who frequented that store. However, Stallman did not like that ice cream, and did not even know of it when choosing the name "Emacs"; this ignorance is the basis of a hacker koan, Emacs and Bolio).
Stallman saw a problem in too much customization and de-facto forking and set certain conditions for usage. He later wrote:
The original Emacs, like TECO, ran only on the PDP line of computers. It behaved sufficiently differently from TECO to be considered a text editor in its own right. It quickly became the standard editing program on ITS. It was also ported from ITS to the Tenex and TOPS-20 operating systems by Michael McMahon, but not Unix, initially. Other contributors to early versions of Emacs include Kent Pitman, Earl Killian, and Eugene Ciccarelli. By 1979, Emacs was the editor used by most people in MIT's AI lab and its Computer Science lab.[5]
Programmers wrote many Emacs-like editors in the following years for other computer systems, including SINE (Sine is not EMACS), EINE ("EINE Is Not EMACS") and ZWEI ("ZWEI Was EINE Initially"), for the Lisp machine, which were written by Michael McMahon and Daniel Weinreb. Weinreb's EINE was the first Emacs written in Lisp. In 1978, Bernard Greenberg wrote Multics Emacs almost entirely in Multics Lisp at Honeywell's Cambridge Information Systems Lab; it was later maintained by Richard Soley (who went on to develop the NILE Emacs-like editor for the NIL Project) and Barry Margolin. Many versions of Emacs, including GNU Emacs, later adopted Lisp as an extension language.
James Gosling (who later invented NeWS and the Java programming language) wrote the first Emacs-like editor to run on Unix: Gosling Emacs, in 1981. It was written in C and, notably, used a language with Lisp-like syntax known as Mocklisp as an extension language. In 1984 it was proprietary software.
In 1984, Stallman began working on GNU Emacs to produce a free software alternative to Gosling Emacs; initially he based it on Gosling Emacs, but he replaced the Mocklisp interpreter at its heart with a true Lisp interpreter, which entailed replacing nearly all of the code. It became the first program released by the nascent GNU project. GNU Emacs is written in C and provides Emacs Lisp (itself implemented in C) as an extension language. Version 13, the first public release, was made on March 20, 1985. The first widely distributed version of GNU Emacs was 15.34, which appeared later in 1985. Versions 2 to 12 never existed. Earlier versions of GNU Emacs had been numbered "1.x.x", but sometime after version 1.12 the decision was made to drop the "1", as it was thought the major number would never change.
GNU Emacs was later ported to Unix. Since it had more features than Gosling Emacs, in particular a full-featured Lisp as extension language, it soon replaced Gosling Emacs as the de facto Emacs editor on Unix. A security flaw in GNU Emacs' email subsystem was exploited by Markus Hess in his 1986 hacking spree to gain superuser access to Unix computers.[6]
Until 1999, GNU Emacs development was relatively closed, to the point where it was used as an example of the "Cathedral" development style in The Cathedral and the Bazaar. The project has since adopted a public development mailing list and anonymous CVS access. Development takes place in a single CVS trunk, which was at version 23.0.60 as of mid-2008.
Richard Stallman remained the maintainer of GNU Emacs through most of the time, but took several breaks. The latest one persists and started 2008, when maintenance was handed over to Stefan Monnier and Chong Yidong.[7]
Version | Release date | Significant changes |
---|---|---|
23.2 | May 8, 2010 | New tools for using Emacs as an IDE, including navigation across a project and automatic Makefile generation. New major mode for editing JavaScript source. The mouse is hidden while the user is typing. |
23.1 | July 29, 2009 | Xft support (anti-aliased fonts are now supported on X [8]), Better Unicode support, New modes and packages for viewing PDF and postscript files (Doc-view mode), connecting to processes through D-Bus (dbus), connecting to the GNU Privacy Guard (EasyPG), editing XML documents (nXML mode), editing Ruby programs (Ruby mode), and more. On Mac OS X, the use of the Carbon GUI libraries was replaced by use of the more modern Cocoa GUI libraries. |
22.3 | September 5, 2008 | GTK+ toolkit support, enhanced mouse support, a new keyboard macro system, improved Unicode support, and drag-and-drop operation on X, plus many new modes and packages including a graphical user interface to GDB, Python mode, the mathematical tool Calc, and the remote file editing system Tramp ("Transparent Remote (file) Access, Multiple Protocol"[9]). |
22.2 | March 26, 2008 | New support for the Bazaar, Mercurial, Monotone, and Git version control systems New major modes for editing CSS, Vera, Verilog, and BibTeX style files Improved scrolling support in Image mode |
22.1 | June 2, 2007 | Support for the GTK+ graphical toolkit Support for Drag-and-drop on X Support for images, toolbar, and tooltips Unicode support Support for Mac OS X Carbon UI |
21.1 | October 20, 2001 | Support for displaying colors and some other attributes on terminals Built-in horizontal scrolling Sound support Wheel mouse support Improved menu-bar layout |
20.1 | September 17, 1997 | Multi-lingual support |
19.28 | November 1, 1994 | Support for multiple frames using the X Windowing System New interface for version control systems, called VC New hexl mode, which is a hexadecimal editing mode |
18.24 | October 2, 1986 | |
17.36 | December 20, 1985 | Backup file version numbers |
16.56 | July 15, 1985 | |
15.10 | April 11, 1985 | |
13.0? | March 20, 1985 |
Beginning in 1991, Jamie Zawinski and others at Lucid Inc. developed Lucid Emacs, based on an early alpha version of GNU Emacs 19. The codebases soon diverged, and the separate development teams gave up trying to merge them back into a single program.[10] This was one of the most famous early forks of a free software program. Lucid Emacs has since been renamed XEmacs; it remains the second most popular variety of Emacs, after GNU Emacs.
Many other derivatives of the GNU Emacs have emerged, such as a Japanese version for MS Windows called Meadow,[11] Steve Youngs' fork of XEmacs called SXEmacs,[12] and a version which focuses on integrating with the Apple Macintosh user interface called Aquamacs.
Emacs clones, not based on GNU Emacs source code, have proliferated. One motivation for writing clones was that GNU Emacs was initially targeted at computers with a 32-bit flat address space, and at least 1 MiB of RAM. At a time when such computers were considered high end, this left an opening for smaller reimplementations. Some notable modern clones include:
The terms of the GNU General Public License (GPL) make Emacs source code, including both the C and Emacs Lisp components, freely available for examination, modification, and redistribution.
For GNU Emacs (and GNU packages in general), it remains policy to accept significant code contributions only if the copyright holder executes a suitable disclaimer or assignment of their copyright interest to the Free Software Foundation, although one exception to this policy occurred in the case of MULE (MULtilingual Extension, which handles Unicode and more advanced methods of dealing with other languages' scripts) code[15], since the copyright holder (the Japanese government) could not assign copyright. This does not apply to extremely minor code contributions of less than 10 lines, or to bug fixes. This policy is in place so that FSF can defend the software in court if its copyleft licence is violated.
Older versions of the GNU Emacs documentation appeared under an ad-hoc license which required the inclusion of certain text in any modified copy. In the GNU Emacs user's manual, for example, this included how to obtain GNU Emacs and Richard Stallman's political essay The GNU Manifesto. The XEmacs manuals, which were inherited from older GNU Emacs manuals when the fork occurred, have the same license. Newer versions of the documentation use the GNU Free Documentation License and makes use of "invariant sections" to require the inclusion of the same documents, additionally requiring that the manuals proclaim themselves as GNU Manuals.
Emacs is primarily a text editor, not a word processor; it concentrates on manipulating pieces of text, rather than manipulating the typeface (the "font") of the characters or printing documents (though Emacs can do these as well). Emacs provides commands to manipulate words and paragraphs (deleting them, moving them, moving through them, and so forth), syntax highlighting for making source code easier to read, and "keyboard macros" for performing arbitrary batches of editing commands defined by the user.
GNU Emacs is a "real-time display" editor in that edits get displayed on the screen as they occur. This is standard behaviour for modern text editors.
Almost all of the functionality in the GNU Emacs editor, ranging from basic editing operations such as the insertion of characters into a document to the configuration of the user interface, comes under the control of a dialect of the Lisp programming language known as Emacs Lisp. This unique and unusual design provides many of the features found in Emacs. In this Lisp environment, variables and even entire functions can be modified without having to recompile or even restart the editor.
Users have three primary ways of customizing Emacs:
.emacs
and loaded when Emacs starts up. The .emacs
file is often used to set variables and key bindings different from the default setting, and to define new commands that the user finds convenient. Many advanced users have .emacs
files hundreds of lines long, with idiosyncratic customizations that cause Emacs to diverge wildly from the default behavior.As a result, the behavior of Emacs can be modified almost without limit, either directly by the user, or by loading Emacs Lisp code known variously as "libraries", "packages", or "extensions".
Emacs contains a large number of Emacs Lisp libraries, and users can find more "third-party" libraries on the Internet. Emacs can be used as an Integrated Development Environment (IDE), allowing programmers to edit, compile, and debug their code within a single interface. Other libraries perform more unusual functions. A few examples include:
Many third-party libraries exist on the Internet; for example, there is a library called wikipedia-mode for editing Wikipedia articles. There is even a Usenet newsgroup, gnu.emacs.sources, which is used for posting new libraries. Some third-party libraries eventually make their way into Emacs, thus becoming a "standard" library.
On the systems in which Emacs was first implemented, Emacs often ran noticeably slower than rival text editors, because its Lisp-based design incurs a performance overhead resulting from loading and interpreting the Lisp code. Several joke backronyms allude to this: Eight Megabytes And Constantly Swapping (from the days when eight megabytes was a lot of memory), Emacs Makes A Computer Slow, Eventually Mallocs All Computer Storage, and Eventually Makes All Computers Sick. However, modern computers are fast enough that Emacs is seldom felt to be slow. In fact, Emacs starts up more quickly than most modern word processors. Handling large files on 32 bit systems is still a weak point for Emacs. Before version 23.2 Emacs could handle files up to around 256 MB, with 23.2 this was raised to around 512 MB. Emacs on 64 bit systems does not suffer from this problem, it can open files up to 1024 petabytes.
Emacs has become one of the most ported non-trivial computer programs. It runs on a wide variety of operating systems, including most Unix-like systems (GNU/Linux, the various BSDs, Solaris, AIX, IRIX, Mac OS X,[16][17] etc.), MS-DOS, Microsoft Windows[18][19][20] and OpenVMS. Unix systems, both free and proprietary, frequently provide Emacs bundled with the operating system.
Emacs runs both on text terminals and in graphical user interface (GUI) environments. On Unix-like operating systems, Emacs uses the X Window System to produce its GUI, either directly or using a "widget toolkit" such as Motif, LessTif, or GTK+. Emacs can also use the native graphical systems of Mac OS X (using the Carbon or Cocoa interfaces) and Microsoft Windows. The graphical interface provides menubars, toolbars, scrollbars, and context menus.
Emacs adapts its behavior to the types of text it edits by entering add-on modes called "major modes". Defined major modes exist for ordinary text files, for source code of many programming languages, for HTML documents, for TeX and LaTeX documents, and for many other types of text. Each major mode involves an Emacs Lisp program that extends the editor to behave more conveniently for the particular type of text it covers. Typical major modes will provide some or all of the following common features:
Programmers can add extra customized features by using "minor modes". While an Emacs editing buffer can use only one major mode at a time, multiple minor modes can operate simultaneously. These may affect documents directly. For example, the major mode for the C programming language defines a different minor mode for each of the popular indent styles. Or minor modes may affect the editing environment instead. For example, "Winner mode" adds the ability to undo changes to the window configuration, while "MMM-mode" adds the ability to use more than one major mode in a single file, as required in common cases such as editing an HTML document with embedded CSS and JavaScript.
The SLIME major mode extends Emacs into a development environment for Common Lisp. With SLIME the Emacs editor communicates with a (possibly remote) Common Lisp system over a special communication protocol and provides tools like a Read-Eval-Print-Loop, a data inspector and a debugger.
The first Emacs included an innovative help library that can display the documentation for every single command, variable, and internal function. (It may have originated this technique.) Because of this, Emacs-proponents described the tools as "self-documenting" — in that it presents its own documentation, not only of its normal features but also of its current state, to the user. For example, the user can find out about the command bound to a particular keystroke simply by entering C-h k
(which runs the command describe-key
), followed by the keystroke. Each function includes a documentation string, specifically to be used for showing to the user on request. The practice of giving functions documentation strings subsequently spread to various programming languages such as Lisp and Java.
Further, through Emacs's help system, users can be taken to the actual code for each function — whether a built-in library or an installed third-party library.
Emacs also has a built-in tutorial. When Emacs starts with no file to edit, it displays instructions for performing simple editing commands and invoking the tutorial.
Apart from the built-in documentation, Emacs has an unusually long, detailed and well-written manual. An electronic copy of the GNU Emacs Manual, written by Richard Stallman, comes bundled with GNU Emacs and can be viewed with the built-in Info browser. Two other manuals, the Emacs Lisp Reference Manual by Bil Lewis, Richard Stallman, and Dan Laliberte, and An Introduction to Programming in Emacs Lisp by Robert Chassell, are also included. Apart from the electronic versions, all three manuals are also available in book form, published by the Free Software Foundation. XEmacs has a similar manual to the GNU Emacs Manual, which forked from the GNU Emacs Manual at the same time as the XEmacs software.
Emacs supports the editing of text written in many human languages. It has support for many alphabets, scripts, writing systems, and cultural conventions. Emacs provides spell-checking for many languages by calling external programs such as ispell. Many encoding systems, including UTF-8, are supported. In Emacs 22 Unicode support is fairly advanced; however, it uses Emacs-specific encoding internally,[21] necessitating conversion upon load and save.
In Emacs 23, UTF-8 has become the Emacs-internal encoding. As for writing direction however, only left to right writing is supported.
The Emacs user interface originated in English, and has not been translated into any other language, with the exception of the beginners' tutorial.
Visually-impaired and blind users can use a subsystem called Emacspeak which allows the editor to be used through audio feedback only.
In the normal editing mode, Emacs behaves like other text editors: the character keys (a, b, c, 1, 2, 3, etc.) insert the corresponding characters, the arrow keys move the editing point, backspace deletes text, and so forth. Users invoke other commands with modified keystrokes: pressing the control key and/or the meta key/alt key/Escape key in conjunction with a regular key. Every editing command is actually an invocation of a function in the Emacs Lisp environment. Even a command as simple as typing a
to insert the character a involves calling a function — in this case, self-insert-command
.
Alternatively, users preferring IBM Common User Access style keys can use "cua-mode". This has been a third-party package up to, and including, GNU Emacs 21, but is included in GNU Emacs from version 22 onward.
Note that the commands save-buffer
and save-buffers-kill-emacs
use multiple modified keystrokes. For example, C-x C-c
means: while holding down the control key, press x; then, while holding down the control key, press c. This technique, which allows binding more commands to the keyboard than with the use of single keystrokes alone, was popularized by Emacs, which got it from TECMAC, one of the TECO macro collections that immediately preceded Emacs. It has since made its way into modern code editors like Visual Studio, and is even used to some extent by some consumer word processors such as Microsoft Word.
Some Emacs commands work by invoking an external program (such as ispell for spell-checking or gcc for program compilation), parsing the program's output, and displaying the result in Emacs.
Emacs uses the minibuffer (normally the bottommost line) to request information. Text to target in a search, the name of a file to read or save and similar information is entered in the minibuffer. When applicable, command line completion is usually available using the tab and space keys.
Emacs keeps text in objects called buffers. The user can create new buffers and dismiss unwanted ones, and several buffers can exist at the same time. Most buffers contain text loaded from text files, which the user can edit and save back to disk. Buffers also serve to store temporary text, such as the documentation strings displayed by the help library.
In both text-terminal and graphical modes, Emacs can split the editing area into separate sections (referred to since 1975 as "windows", which can be confusing on systems that have another concept of "windows" as well), so that more than one buffer can be displayed at a time. This has many uses. For example, one section can be used to display the source code of a program, while another displays the results from compiling the program. In graphical environments, Emacs can also launch multiple graphical-environment windows, known as "frames" in the context of Emacs.
The original Space-cadet keyboard Emacs was developed on had the Control keys adjacent to the space bar, making them easy to hit with the thumb, and both it and the dedicated Meta key were larger than the regular keys. These keys are more difficult to press on today's common IBM PC keyboard layout. Because of Emacs' dependence on these modifier keys, and in particular because of how many keyboard-users press control keys with the little finger ("pinky"), heavy Emacs users have experienced repetitive strain injury pain in their pinky fingers.[22] This has been dubbed the "Emacs Pinky", and vi advocates often cite it as a reason to switch to vi—even though vi users often transpose Caps Lock with their mode change key for similar reasons.[23]
To reduce strain stretching for the Control key, many Emacs users transpose the left Control key and the left Caps-lock key or define both as Control keys.[24] Some use viper-mode, a feature built into Emacs that allows the use of the vi keys for basic text editing and the Emacs keys for more advanced features.[25] Some use StickyKeys as a means to turn key combinations into key sequences.[26] Others use special keyboards such as Kinesis's Contoured Keyboard, which reduces the strain by moving the modifier keys so that they are in a position to be easily pushed by the thumb, or the Microsoft Natural keyboard, which has large modifier keys placed symmetrically on both sides of the keyboard so that they can be pressed with the palm.[22]
charset.h
of the source code. The internal encoding used by XEmacs is similar but differs in details.
|
|